package com.moecollege.moecollegelib.base;

import android.app.Application;
import android.content.Context;

import com.android.volley.RequestQueue;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.moecollege.moecollegelib.log.MoeLog;
import com.tencent.bugly.crashreport.CrashReport;

/**
 * Created by nieyonghui on 15-5-27.
 */
public class BaseApplaction extends Application {
    private RequestQueue mQueue;
    private static BaseApplaction mApp;

    public static BaseApplaction getInstance() {
        return mApp;
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        mApp = this;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        //初始化bugly
        String appId = "900003793";   //上Bugly(bugly.qq.com)注册产品获取的AppId
        boolean isDebug = MoeLog.isDebug ;  //true代表App处于调试阶段，false代表App发布阶段
        CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(getApplicationContext()); //App的策略Bean
      //  strategy.setAppChannel( "myChannel");     //设置渠道
        strategy.setAppVersion( "BuglyDemo_1.0");      //App的版本
        strategy.setAppReportDelay(5000);  //设置SDK处理延时，毫秒
        CrashReport.initCrashReport(this, appId, isDebug, strategy); //自定义策略生效，必须在初始化SDK前调用

        //初始化fresco
        Fresco.initialize(this);
    }
}
